<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>MRtrix documentation</title>
<link rel="stylesheet" href="../stylesheet.css" type="text/css" media=screen>
</head>
<body>

<table class=nav>
  <tr>
    <td><a href="index.html"><img src="../left.png"></a></td>
    <td><a href="index.html"><img src="../up.png"></a></td>
    <td><a href="../index.html"><img src="../home.png"></a></td>
    <th>Overview</th>
    <td><a href="cmdline.html"><img src="../right.png"></a></td>
  </tr>
</table>


<p>
<strong>Note:</strong> in command examples, user input is shown using a <code><b>bold font</b></code>, 
and command output using a <code>normal font</code>.
</p>

<h2><a name="cmdline">Command-line example</a></h2>
<p>
To illustrate the use of MRtrix applications from the command-line, we start with the simple program <kbd><a href='../commands/mrinfo.html'>mrinfo</a></kbd>. 
This program simply prints out relevant header information found in the image specified.
For example:
</p>
<pre>
&gt; <b><a href='../commands/mrinfo.html'>mrinfo</a> image.img</b>
************************************************
Image:               "image.img"
************************************************
  Format:            Analyse 7.5
  Dimensions:        192 x 256 x 256
  Voxel size:        0.9 x 0.898438 x 0.898438
  Dimension labels:  0. left->right (mm)
                     1. posterior->anterior (mm)
                     2. inferior->superior (mm)
  Data type:         unsigned 16 bit integer (little endian)
  Data layout:       [ +0 +1 +2 ]
  Data scaling:      offset = 0, multiplier = 1
  Comments:          Example image
  Transform:                  1         0         0     -86.4
                              0         1         0      -115
                              0         0         1      -115
                              0         0         0         1
</pre>
<p>
In this case, the image is in Analyse format, identified by the extension <kbd>.img</kbd>. 
MRtrix applications support a variety of <a href=formats.html>image file formats</a>.
</p>
<p>
Detailed information on a particular command can be obtained using the <kbd>-help</kbd> option.
For example:
</p>
<pre>
&gt; <b><a href='../commands/mrinfo.html'>mrinfo</a> -help</b>
<a href='../commands/mrinfo.html'>mrinfo</a>: part of the MRtrix package

PURPOSE:  display header information

SYNTAX:   mrinfo [ options ] image [ image ... ]

            image       the input image.

OPTIONS:

  -grad file    write DW gradient scheme to file
                "file": the DW gradient scheme file.

  -dicom        print all DICOM entries.

  -csa          print all CSA entries (Siemens DICOM only.

  -info         display information messages.

  -quiet        do not display information messages or progress status.

  -debug        display debugging messages.

  -help         display this information page and exit.

  -version      display version information and exit.
</pre>
<p>
Another useful command is <kbd><a href='../commands/mrconvert.html'>mrconvert</a></kbd>.
Here is a typical example:
</p>
<pre>
&gt; <b><a href='../commands/mrconvert.html'>mrconvert</a> /data/DICOM_folder/ image.img</b>
<a href='../commands/mrconvert.html'>mrconvert</a>: copying data... 100%
</pre>
<p>
This will convert the DICOM data stored in the <code>/data/DICOM_folder/</code> folder into the Analyse format image <code>image.img</code>.
The user will be prompted to select the relevant image series if several are found.
</p>
<p>
There are many useful options for <kbd><a href='../commands/mrconvert.html'>mrconvert</a></kbd>. 
For example:
</p>
<pre>
&gt; <b><a href='../commands/mrconvert.html'>mrconvert</a> /data/DICOM_folder/ -datatype float32 -coord 2 10:30 image.img</b>
<a href='../commands/mrconvert.html'>mrconvert</a>: copying data... 100%
</pre>
<p>
This will instruct <kbd><a href='../commands/mrconvert.html'>mrconvert</a></kbd> to convert the data as before, but the intensity values in the resulting image will be stored as 32-bit floating-point values,
and the image will only contain slices 10 through to 30 
(more details on specifying such sequences of numbers are given <a href='cmdline.html#sequences'>here</a>)
</p>


<p class=sep><a href="#top">top</a></p>


<h2><a name="mrview">MRView - the MRtrix viewer</a></h2>
<p>
MRtrix includes a viewing tool, invoked by issuing the command <kbd><a href='../commands/mrview.html'>mrview</a></kbd>. 
MRView can optionally take one or more image specifier as an argument.
For example:
</p>
<pre>
&gt; <b><a href='../commands/mrview.html'>mrview</a> image.img</b>
</pre>
<p>
should open a window similar to the following:
</p>
<img src=mrview.png>
<p>
Alternatively, images can be opened using the File-&gt;Open menu.
More detailed information about MRView can be found <a href='mrview.html'>here</a>.
</p>


<p class=sep><a href="#top">top</a></p>
<h2><a name='axes'>Coordinate system</a></h2>
<p>
All MRtrix applications will consistently use the same coordinate system. 
Note that this frame of reference differs from the DICOM standard.
The convention followed by MRtrix applications is as follows:
</p>
<table cellspacing=5>
  <tr><th align=center>dimension</th><th>description</th></tr>
  <tr><td align=center>0 (x)</td><td>increasing from left to right</td></tr>
  <tr><td align=center>1 (y)</td><td>increasing from posterior to anterior</td></tr>
  <tr><td align=center>2 (z)</td><td>increasing from inferior to superior</td></tr>
</table>
<p>
All coordinates or vector components supplied to MRtrix applications must be provided with reference to this coordinate system.
</p>


<p class=sep><a href="#top">top</a></p>
<h2><a name="features">Other features</a></h2>
<p>
All MRtrix programs are based on the same underlying infrastructure for image access, 
and should all be capable of handling all <a href='formats.html#fileformats'>supported image formats</a>.
In addition, programs can be connected via <em>pipes</em> such that the data produced by one program can be used immediately by another. 
In this way, a series of sequential operations can be performed by typing a single command (see <a href='cmdline.html#pipes'>Data pipes</a> for details). 
Finally, each program supports a number of standard command-line options that are explained <a href='cmdline.html#stdoptions'>here</a>.
</p>
<p>
Note that none of the MRtrix programs will overwrite any existing image files to avoid unintentional loss of data.
If you need to overwrite a file, you will need to delete it manually before invoking the command to write the new version.
</p>
<p>
Note also that pixel coordinates and study numbers start from zero. For example, the first study in a data set is labelled as <strong>study 0</strong>, the second as <strong>study 1</strong>, etc. and valid pixel coordinates for a 128x128 image range from 0 to 127.
</p>



<table class=nav>
  <tr>
    <td><a href="index.html"><img src="../left.png"></a></td>
    <td><a href="index.html"><img src="../up.png"></a></td>
    <td><a href="../index.html"><img src="../home.png"></a></td>
    <th><a href='#top'>top</a></th>
    <td><a href="cmdline.html"><img src="../right.png"></a></td>
  </tr>
</table>

</body>
</html>
